<?
//print_r($_POST);
if($_POST)
{
	if($_FILES["photo"]["name"] != "")
	{
	$newname = explode(".",$_FILES['photo']['name']);
	$newname = "favicon.".$newname[(sizeof($newname)-1)];
	@unlink("../imgs/".$_POST['oldpic']);
	@copy($_FILES["photo"]["tmp_name"],"../imgs/".strtolower($newname));
	$v['tables'] = "";
	$v['img_function'] = "favicon";
	$v['img_name1'] = $_POST['img_name1'];
	$v['img_link'] = $_POST['img_link'];
	$v['img_pic'] = strtolower($newname);
	$v['img_ip'] = $_SERVER['REMOTE_ADDR'];
	$chk = Q2("select * from images where img_function = 'favicon' ");
	if(count($chk) < 1){
		Qinsert("images","",$v);
	}else{
		Qupdate("images","",$v," img_function = 'favicon' ");
	}
	sleep(3);
	exit("<script type=\"text/javascript\">window.location='home.php?body=faviconsetting';</script>");
	}
}
?>

<p>

<img src="<?=faviconsetting()?>"  >
</p>

<p>
<fieldset>
<legend>Edit my  favicon</legend>
<form action="" method="post" enctype="multipart/form-data" name="form1">
<label>Image file</label><input name="photo" type="file" /><br/><br/>
<input name="" type="submit" value="<?=btsubmit()?>" />
<INPUT TYPE="hidden" name="oldpic" value="<?=faviconsetting()?>">
</form>
</fieldset>
</p>